<script type="text/javascript"><!--//--><![CDATA[//><!--

    var grid_reload = function() {
        $('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
    };
    
    $(document).ready(function() {
       // Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			//singleSelect:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center' },
				{ field : 'no_po', title : 'Nomor PO', width : 150, sortable:true },	
				{ field : 'no_sttb', title : 'Nomor STTB', width : 150, sortable:true },			
				{ field : 'tgl_order', title : 'Tanggal PO', width : 150, align:'left', sortable:true },
				{ field : 'tgl_terima', title : 'Tanggal Terima', width : 150, align:'left', sortable:true },
				{ field : 'tgl_jatuh_tempo', title : 'Tanggal Jatuh Tempo', width : 150, align:'left', sortable:true },
				{ field : 'kd_vendor', title : 'Kode Vendor', width : 100, align:'left', sortable:true },
				{ field : 'nama_vendor', title : 'Nama Vendor', width : 300, align:'left', sortable:true },
				{ field : 'jenis_pembayaran', title : 'Jenis Pembayaran', width : 120, align:'left', sortable:true }
			]]
		});
        
        // Set Action Button
        var buttons = [
                       
                        // ----- >> Edit Button
					    { label: 'Edit', icon: 'edit', onclick: function() {
					        var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								loadPage(gs_path + '/' + controller + '/edit/?no_po='+urlencode(oSel.no_po));
					        } 
					    }},

					    // ----- >> Delete Button
						{label: 'Delete', icon: 'delete', onclick: function() { 
							var oSel = $('#datagrid').datagrid('getSelected'); 
							if (oSel == null) { 
								$.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
							} else { 
								deleteData(['no_po']);
							} 
					    }},
						
						// ----- >> Print Button
					    { label: 'Print', icon: 'print', onclick: function() {
							var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								window.open(gs_path+'/'+controller+'/cetak/?no_po='+urlencode(oSel.no_po), 'myWin', 'height=500,width=700,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes');
							}
					    }},
						 ];
        setAction(buttons);
		
		
		$('#fm_search').focusFirst();
    });
//--><!]]></script>

    
<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>